package com.module.itemeditor
{
	import flash.utils.getQualifiedClassName;
	
	import org.phprpc.util.PHPSerializer;
	

	public class CfgItem
	{
		private var _id:int;
		private var _attrs:Array;
		
		public function CfgItem()
		{
			
		}

		public function get id():int
		{
			return _id;
		}

		public function set id(value:int):void
		{
			_id = value;
		}

		public function get attrs():Array
		{
			return _attrs;
		}

		public function set attrs(value:Array):void
		{
			if(value){
				for each(var obj:* in value){
					obj = PHPSerializer.unserialize(PHPSerializer.serialize(obj));
				}
			}
			_attrs = value;
		}
		
		public function getAttribute(name:String):Object
		{
			for each(var obj:Object in this.attrs){
				if(obj['name'] == name){
					return obj['value'];
				}
			}
			return null;
		}

	}
}